<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>VUE3</title>
  </head>
  <body>
    <div id="app"></div>

    <template id="tpl">
      <h2>资源列表</h2>
      <ul>
        <!-- <li v-for="res in resources" :key="res">{{ res }}</li> -->
        <li v-for="(res, idx) in resources" :key="res">#{{idx}} {{ res }}</li>
      </ul>
      <h2>个人信息</h2>
      <ul>
        <!-- <li v-for="item in info" :key="item">{{ item }}</li> -->
        <!-- <li v-for="(val, key) in info" :key="val">{{key}}: {{ val }}</li> -->
        <li v-for="(val, key, idx) in info" :key="val">
          #{{idx}} {{key}}: {{ val }}
        </li>
      </ul>
      <h2>遍历数字</h2>
      <ul>
        <li v-for="n in 10" :key="n">{{n}}</li>
      </ul>
      <h2>遍历字符串</h2>
      <ul>
        <li v-for="s in 'Hello, 世界'" :key="s">{{s}}</li>
      </ul>
    </template>

    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script>
      Vue.createApp({
        template: "#tpl",
        data() {
          return {
            resources: [
              "圣女的魔力是万能的",
              "修女2",
              "天使与龙的轮舞",
              "大楼里只有谋杀",
              "万卷风雅集",
            ],
            info: {
              name: "yesen",
              age: 18,
              address: "火星大街1024号",
            },
          };
        },
      }).mount("#app");
    </script>
  </body>
</html>
